package com.example.mybatis.controller;

import com.example.mybatis.bean.SafetyEducation;
import com.example.mybatis.service.SafetyEducationService;
import com.example.mybatis.utils.ResultUtil;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

@RestController
@RequestMapping("safetyEducation")
public class SafetyEducationController {
    @Resource
    SafetyEducationService safetyEducationService;

    @RequestMapping("selectList")
    public ResultUtil selectList( String title,Integer catalogueId ){
        return safetyEducationService.selectList(title,catalogueId);
    }

    @RequestMapping("selectList1")
    public ResultUtil selectList1( String name,String status ){
        return safetyEducationService.selectList1(name,status);
    }

    @RequestMapping("save")
    public ResultUtil save(@RequestBody SafetyEducation safetyEducation){
        return safetyEducationService.save(safetyEducation);
    }


    @RequestMapping("selectAll")
    public ResultUtil selectAll( String learningStyle){
        return safetyEducationService.selectAll(learningStyle);
    }

    @RequestMapping("selectFinishPercent")
    public ResultUtil selectFinishPercent(@DateTimeFormat(pattern="yyyy-MM") Date month){
        System.out.println(month);
        return safetyEducationService.selectFinishPercent(month);
    }

    @RequestMapping("selectDetail")
    public ResultUtil selectDetail(Integer detailsId){
        return safetyEducationService.selectDetail(detailsId);
    }

    @RequestMapping("selectStudent")
    public ResultUtil selectStudent(Integer studentInformationId){
        return safetyEducationService.selectStudent(studentInformationId);
    }


    @RequestMapping("selectGraphData")
    public ResultUtil selectGraphData(){
        return safetyEducationService.selectGraphData();
    }



}
